package dj.tic;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;

import dj.engine.panel.Panel;
import dj.engine.panel.TextPanel;
import dj.engine.screen.LayoutManager;
import dj.engine.screen.Screen;
import dj.engine.screen.SquareAndSidebarsManager;
import dj.engine.util.Vec2f;
import dj.engine.util.Vec2i;

public class GameScreen extends Screen {

	private LayoutManager gameLayout;
	private Panel gamePanel;
	private TicHUDPanel HUDPanel;
	private int gameSize;
	private TicState gameState;
	public GameScreen(int sideLength, Vec2f size)
	{
		
		gameSize = sideLength;
		gameState = new TicState(gameSize);
		gameLayout = new SquareAndSidebarsManager();
		gamePanel = new TicTacToePanel(gameSize, new Vec2f(0,0), size);
		HUDPanel = new TicHUDPanel(size, new Vec2f(0,0), gameState);
		gameLayout.add(gamePanel, SquareAndSidebarsManager.CENTER);
		gameLayout.add(HUDPanel, SquareAndSidebarsManager.LEFT);
		this.onResize(new Vec2i((int)size.x, (int)size.y));
	}
	
	
	@Override
	public void onTick(long nanosSincePreviousTick) {
		// TODO Auto-generated method stub
		gameState.timeElapsed(nanosSincePreviousTick);
		HUDPanel.onTick(nanosSincePreviousTick);
	}

	@Override
	public void onDraw(Graphics2D g) {
		// TODO Auto-generated method stub
		gamePanel.onDraw(g);
		HUDPanel.onDraw(g);
	}

	@Override
	public void onKeyTyped(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onKeyPressed(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onKeyReleased(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onMouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onMousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onMouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onMouseDragged(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onMouseMoved(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onMouseWheelMoved(MouseWheelEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onResize(Vec2i newSize) {
		gameLayout.onResize(newSize);
		
	}


	@Override
	public boolean isTransparent() {
		// TODO Auto-generated method stub
		return false;
	}

}
